package com.lagou.service.impl;

import com.lagou.service.EmailService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

import java.util.Date;

@Service
public class EmailServiceImpl implements EmailService {

    @Autowired
    JavaMailSender javaMailSender;

    @Override
    public boolean sendEmail(String email, String code) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("拉勾网站");
        message.setFrom("573955423@qq.com");
        message.setTo(email);
        //message.setCc("37xxxxx37@qq.com");
        //message.setBcc("14xxxxx098@qq.com");
        message.setSentDate(new Date());
        message.setText("您的验证码："+code);
        javaMailSender.send(message);
        return true;
    }
}
